home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gameplan.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  27KB  |  671 lines

  1. /***************************************************************************
  2.  
  3. GAME PLAN driver, used for games like MegaTack, Killer Comet, Kaos, Challenger
  4.  
  5. driver by Chris Moore
  6.  
  7. TO-DO: - Fix the input ports/dip switches of Kaos?
  8.        - Graphics are still somewhat scrambled sometimes (just look at
  9.          the tests with f2/f1)
  10.  
  11. ****************************************************************************/
  12.  
  13. #include "driver.h"
  14. #include "vidhrdw/generic.h"
  15.  
  16. int gameplan_vh_start(void);
  17. READ_HANDLER( gameplan_video_r );
  18. WRITE_HANDLER( gameplan_video_w );
  19. READ_HANDLER( gameplan_sound_r );
  20. WRITE_HANDLER( gameplan_sound_w );
  21. READ_HANDLER( gameplan_via5_r );
  22. WRITE_HANDLER( gameplan_via5_w );
  23.  
  24. static int gameplan_current_port;
  25.  
  26. static WRITE_HANDLER( gameplan_port_select_w )
  27. {
  28. #ifdef VERY_VERBOSE
  29.     logerror("VIA 2: PC %04x: %x -> reg%X\n",cpu_get_pc(), data, offset);
  30. #endif /* VERY_VERBOSE */
  31.  
  32.     switch (offset)
  33.     {
  34.         case 0x00:
  35.             switch(data)
  36.             {
  37.                 case 0x01: gameplan_current_port = 0; break;
  38.                 case 0x02: gameplan_current_port = 1; break;
  39.                 case 0x04: gameplan_current_port = 2; break;
  40.                 case 0x08: gameplan_current_port = 3; break;
  41.                 case 0x80: gameplan_current_port = 4; break;
  42.                 case 0x40: gameplan_current_port = 5; break;
  43.  
  44.                 default:
  45. #ifdef VERBOSE
  46.                     logerror("  VIA 2: strange port request byte: %02x\n", data);
  47. #endif
  48.                     return;
  49.             }
  50.  
  51. #ifdef VERBOSE
  52.             logerror("  VIA 2: selected port %d\n", gameplan_current_port);
  53. #endif
  54.             break;
  55.  
  56.         case 0x02:
  57. #ifdef VERBOSE
  58.             logerror("  VIA 2: wrote %02x to Data Direction Register B\n", data);
  59. #endif
  60.             break;
  61.  
  62.         case 0x03:
  63. #ifdef VERBOSE
  64.             logerror("  VIA 2: wrote %02x to Data Direction Register A\n", data);
  65. #endif
  66.             break;
  67.  
  68.         case 0x0c:
  69.             if (data == 0xec || data == 0xcc)
  70.             {
  71. #ifdef VERBOSE
  72.                 logerror("  VIA 2: initialised Peripheral Control Register to 0x%02x for VIA 2\n",data);
  73. #endif
  74.             }
  75.             else
  76.                 logerror("  VIA 2: unusual Peripheral Control Register value 0x%02x for VIA 2\n",data);
  77.             break;
  78.  
  79.         default:
  80.             logerror("  VIA 2: unexpected register written to in VIA 2: %02x -> %02x\n",
  81.                         data, offset);
  82.             break;
  83.     }
  84. }
  85.  
  86. static READ_HANDLER( gameplan_port_r )
  87. {
  88.     return readinputport(gameplan_current_port);
  89. }
  90.  
  91. static struct MemoryReadAddress readmem[] =
  92. {
  93.     { 0x0000, 0x03ff, MRA_RAM },
  94.     { 0x032d, 0x03d8, MRA_RAM }, /* note: 300-32c and 3d9-3ff is
  95.                                   * written but never read?
  96.                                   * (write by code at e1df and e1e9,
  97.                                   * 32d is read by e258)*/
  98.     { 0x2000, 0x200f, gameplan_video_r },
  99.     { 0x2801, 0x2801, gameplan_port_r },
  100.     { 0x3000, 0x300f, gameplan_sound_r },
  101.     { 0x9000, 0xffff, MRA_ROM },
  102.  
  103.     { -1 }                        /* end of table */
  104. };
  105.  
  106. static struct MemoryWriteAddress writemem[] =
  107. {
  108.     { 0x0000, 0x03ff, MWA_RAM },
  109.     { 0x2000, 0x200f, gameplan_video_w },        /* VIA 1 */
  110.     { 0x2800, 0x280f, gameplan_port_select_w },    /* VIA 2 */
  111.     { 0x3000, 0x300f, gameplan_sound_w },       /* VIA 3 */
  112.     { 0x9000, 0xffff, MWA_ROM },
  113.  
  114.     { -1 }                        /* end of table */
  115. };
  116.  
  117. static struct MemoryReadAddress readmem_snd[] =
  118. {
  119.     { 0x0000, 0x0026, MRA_RAM },
  120.     { 0x01f6, 0x01ff, MRA_RAM },
  121.     { 0x0800, 0x080f, gameplan_via5_r },
  122.  
  123. #if 0
  124.     { 0xa001, 0xa001, gameplan_ay_3_8910_1_r }, /* AY-3-8910 */
  125. #else
  126.     { 0xa001, 0xa001, soundlatch_r }, /* AY-3-8910 */
  127. #endif
  128.  
  129.     { 0xf800, 0xffff, MRA_ROM },
  130.     { -1 }  /* end of table */
  131. };
  132.  
  133. static struct MemoryWriteAddress writemem_snd[] =
  134. {
  135.     { 0x0000, 0x0026, MWA_RAM },
  136.     { 0x01f6, 0x01ff, MWA_RAM },
  137.     { 0x0800, 0x080f, gameplan_via5_w },
  138.  
  139. #if 0
  140.     { 0xa000, 0xa000, gameplan_ay_3_8910_0_w }, /* AY-3-8910 */
  141.     { 0xa002, 0xa002, gameplan_ay_3_8910_2_w }, /* AY-3-8910 */
  142. #else
  143.     { 0xa000, 0xa000, AY8910_control_port_0_w }, /* AY-3-8910 */
  144.     { 0xa002, 0xa002, AY8910_write_port_0_w }, /* AY-3-8910 */
  145. #endif
  146.  
  147.     { 0xf800, 0xffff, MWA_ROM },
  148.  
  149.     { -1 }  /* end of table */
  150. };
  151.  
  152. int gameplan_interrupt(void)
  153. {
  154.     return 1;
  155. }
  156.  
  157. INPUT_PORTS_START( kaos )
  158.     PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
  159.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  160.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  161.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  162.     PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
  163.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
  164.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
  165.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
  166.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
  167.  
  168.     PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
  169.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  170.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  171.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  172.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  173.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  174.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  175.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  176.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  177.  
  178.     PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
  179.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  180.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Jump", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  181.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  182.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  183.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  184.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  185.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  186.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  187.  
  188.     PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
  189.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  190.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  191.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  192.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  193.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  194.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  195.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  196.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  197.  
  198.     PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
  199.  
  200.     PORT_DIPNAME(0x0f, 0x0f, DEF_STR( Coinage ) ) /* -> 039F */
  201.     PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
  202.     PORT_DIPSETTING(   0x0f, DEF_STR( 1C_1C ) )
  203. //    PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
  204.     PORT_DIPSETTING(   0x0d, DEF_STR( 1C_2C ) )
  205.     PORT_DIPSETTING(   0x0c, DEF_STR( 1C_3C ) )
  206.     PORT_DIPSETTING(   0x0b, DEF_STR( 1C_4C ) )
  207.     PORT_DIPSETTING(   0x0a, DEF_STR( 1C_5C ) )
  208.     PORT_DIPSETTING(   0x09, DEF_STR( 1C_6C ) )
  209.     PORT_DIPSETTING(   0x08, DEF_STR( 1C_7C ) )
  210.     PORT_DIPSETTING(   0x07, DEF_STR( 1C_8C ) )
  211.     PORT_DIPSETTING(   0x06, DEF_STR( 1C_9C ) )
  212.     PORT_DIPSETTING(   0x05, "1 Coin/10 Credits" )
  213.     PORT_DIPSETTING(   0x04, "1 Coin/11 Credits" )
  214.     PORT_DIPSETTING(   0x03, "1 Coin/12 Credits" )
  215.     PORT_DIPSETTING(   0x02, "1 Coin/13 Credits" )
  216.     PORT_DIPSETTING(   0x01, "1 Coin/14 Credits" )
  217.  
  218.     PORT_DIPNAME(0x10, 0x10, "Unknown" ) /* -> 039A */
  219.     PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
  220.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  221.  
  222.     PORT_DIPNAME(0x60, 0x20, "Unknown" ) /* -> 039C */
  223.     PORT_DIPSETTING(   0x60, "1" )
  224.     PORT_DIPSETTING(   0x40, "2" )
  225.     PORT_DIPSETTING(   0x20, "3" )
  226.     PORT_DIPSETTING(   0x00, "4" )
  227.  
  228.     PORT_DIPNAME(0x80, 0x80, DEF_STR( Free_Play ) ) /* -> 039D */
  229.     PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
  230.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  231.  
  232.     PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
  233.  
  234.     PORT_DIPNAME(0x01, 0x01, DEF_STR( Lives ) )
  235.     PORT_DIPSETTING(   0x01, "3" )
  236.     PORT_DIPSETTING(   0x00, "4" )
  237.  
  238.     PORT_DIPNAME(0x02, 0x00, "Unknown" )
  239.     PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
  240.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  241.  
  242.     PORT_DIPNAME(0x0c, 0x00, "Unknown" )
  243.     PORT_DIPSETTING(   0x0c, "1" )
  244.     PORT_DIPSETTING(   0x08, "2" )
  245.     PORT_DIPSETTING(   0x04, "3" )
  246.     PORT_DIPSETTING(   0x00, "4" )
  247.  
  248.     PORT_DIPNAME(0x10, 0x00, "Unknown" )
  249.     PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
  250.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  251.  
  252.     PORT_DIPNAME(0x20, 0x00, "Unknown" )
  253.     PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
  254.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  255.  
  256.     PORT_DIPNAME(0x40, 0x00, "Unknown" )
  257.     PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
  258.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  259.  
  260.     PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
  261.     PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
  262.     PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
  263. INPUT_PORTS_END
  264.  
  265.  
  266. INPUT_PORTS_START( killcom )
  267.     PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
  268.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  269.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  270.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  271.     PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
  272.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
  273.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
  274.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
  275.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
  276.  
  277.     PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
  278.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  279.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  280.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  281.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  282.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  283.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  284.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  285.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  286.  
  287.     PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
  288.     PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1, "P1 Hyperspace", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  289.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  290.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  291.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  292.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  293.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1, "P1 Down", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  294.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  295.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1, "P1 Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  296.  
  297.     PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
  298.     PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2, "P2 Hyperspace", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  299.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  300.     PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  301.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  302.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  303.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2, "P2 Down", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  304.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  305.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2, "P2 Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  306.  
  307.     PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
  308.  
  309.     PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
  310.     PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
  311.     PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
  312.     PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
  313.     PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
  314.  
  315.     PORT_DIPNAME(0x08, 0x08, DEF_STR( Lives ) )
  316.     PORT_DIPSETTING(   0x00, "4" )
  317.     PORT_DIPSETTING(   0x08, "5" )
  318.  
  319.     PORT_DIPNAME(0xc0, 0xc0, "Reaction" )
  320.     PORT_DIPSETTING(   0xc0, "Slowest" )
  321.     PORT_DIPSETTING(   0x80, "Slow" )
  322.     PORT_DIPSETTING(   0x40, "Fast" )
  323.     PORT_DIPSETTING(   0x00, "Fastest" )
  324.  
  325.     PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
  326.  
  327.     PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
  328.     PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
  329.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  330.  
  331.     PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
  332.     PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
  333.     PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
  334. INPUT_PORTS_END
  335.  
  336.  
  337. INPUT_PORTS_START( megatack )
  338.     PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
  339.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  340.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  341.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  342.     PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
  343.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
  344.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
  345.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
  346.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
  347.  
  348.     PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
  349.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  350.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  351.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  352.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  353.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  354.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  355.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  356.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  357.  
  358.     PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
  359.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  360.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  361. /* PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  362.    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )*/
  363.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  364.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  365.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  366.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  367.  
  368.     PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
  369.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  370.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  371. /* PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  372.    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )*/
  373.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  374.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  375.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  376.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  377.  
  378.     PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
  379.     PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
  380.     PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
  381.     PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
  382.     PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
  383.     PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
  384.  
  385.     PORT_DIPNAME(0x08, 0x08, DEF_STR( Lives ) )
  386.     PORT_DIPSETTING(   0x08, "3" )
  387.     PORT_DIPSETTING(   0x00, "4" )
  388.  
  389.     PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
  390.  
  391.     PORT_DIPNAME(0x07, 0x07, DEF_STR( Bonus_Life ) )
  392.     PORT_DIPSETTING(   0x07, "20000" )
  393.     PORT_DIPSETTING(   0x06, "30000" )
  394.     PORT_DIPSETTING(   0x05, "40000" )
  395.     PORT_DIPSETTING(   0x04, "50000" )
  396.     PORT_DIPSETTING(   0x03, "60000" )
  397.     PORT_DIPSETTING(   0x02, "70000" )
  398.     PORT_DIPSETTING(   0x01, "80000" )
  399.     PORT_DIPSETTING(   0x00, "90000" )
  400.  
  401.     PORT_DIPNAME(0x10, 0x10, "Monitor View" )
  402.     PORT_DIPSETTING(   0x10, "Direct" )
  403.     PORT_DIPSETTING(   0x00, "Mirror" )
  404.  
  405.     PORT_DIPNAME(0x20, 0x20, "Monitor Orientation" )
  406.     PORT_DIPSETTING(   0x20, "Horizontal" )
  407.     PORT_DIPSETTING(   0x00, "Vertical" )
  408.  
  409.     PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
  410.     PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
  411.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  412.  
  413.     PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
  414.     PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
  415.     PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
  416. INPUT_PORTS_END
  417.  
  418.  
  419. INPUT_PORTS_START( challeng )
  420.     PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
  421.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  422.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  423.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
  424.     PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
  425.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
  426.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
  427.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  428.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  429.  
  430.     PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
  431.  
  432.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  433.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  434.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  435.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  436.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  437.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
  438.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
  439.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  440.  
  441. PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
  442.  
  443.     PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  444.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  445.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  446.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  447.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  448.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  449.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  450.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  451.  
  452.     PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
  453.  
  454.     PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  455.     PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  456.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  457.     PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  458.     PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  459.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  460.     PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  461.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
  462.  
  463.     PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
  464.  
  465.     PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
  466.     PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
  467.     PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
  468.     PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
  469.     PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
  470.  
  471.     PORT_DIPNAME(0xc0, 0xc0, DEF_STR( Lives ) )
  472.     PORT_DIPSETTING(   0xc0, "3" )
  473.     PORT_DIPSETTING(   0x80, "4" )
  474.     PORT_DIPSETTING(   0x40, "5" )
  475.     PORT_DIPSETTING(   0x00, "6" )
  476.  
  477.     PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
  478.     PORT_DIPNAME(0x07, 0x07, DEF_STR( Bonus_Life ) )
  479.     PORT_DIPSETTING(   0x01, "20000" )
  480.     PORT_DIPSETTING(   0x00, "30000" )
  481.     PORT_DIPSETTING(   0x07, "40000" )
  482.     PORT_DIPSETTING(   0x06, "50000" )
  483.     PORT_DIPSETTING(   0x05, "60000" )
  484.     PORT_DIPSETTING(   0x04, "70000" )
  485.     PORT_DIPSETTING(   0x03, "80000" )
  486.     PORT_DIPSETTING(   0x02, "90000" )
  487.     PORT_DIPNAME(0x10, 0x10, "Monitor View" )
  488.     PORT_DIPSETTING(   0x10, "Direct" )
  489.     PORT_DIPSETTING(   0x00, "Mirror" )
  490.     PORT_DIPNAME(0x20, 0x20, "Monitor Orientation" )
  491.     PORT_DIPSETTING(   0x20, "Horizontal" )
  492.     PORT_DIPSETTING(   0x00, "Vertical" )
  493.     PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
  494.     PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
  495.     PORT_DIPSETTING(   0x00, DEF_STR( On ) )
  496.     PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
  497.     PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
  498.     PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
  499. INPUT_PORTS_END
  500.  
  501.  
  502.  
  503. static unsigned char palette[] =
  504. {
  505.     0xff,0xff,0xff, /* 0 WHITE   */
  506.     0x20,0xff,0xff, /* 1 CYAN    */
  507.     0xff,0x20,0xff, /* 2 MAGENTA */
  508.     0x20,0x20,0xFF, /* 3 BLUE    */
  509.     0xff,0xff,0x20, /* 4 YELLOW  */
  510.     0x20,0xff,0x20, /* 5 GREEN   */
  511.     0xff,0x20,0x20, /* 6 RED     */
  512.     0x00,0x00,0x00, /* 7 BLACK   */
  513. };
  514. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  515. {
  516.     memcpy(game_palette,palette,sizeof(palette));
  517. }
  518.  
  519.  
  520. static struct AY8910interface ay8910_interface =
  521. {
  522.     1,    /* 1 chips */
  523.     1500000,    /* 1.5 MHz ? */
  524.     { 50 },
  525.     { 0 },
  526.     { 0 },
  527.     { 0 },
  528.     { 0 }
  529. };
  530.  
  531.  
  532. static struct MachineDriver machine_driver_gameplan =
  533. {
  534.     /* basic machine hardware */
  535.     {                            /* MachineCPU */
  536.         {
  537.             CPU_M6502,
  538.             3579000 / 4,        /* 3.579 / 4 MHz */
  539.             readmem, writemem, 0, 0,
  540.             gameplan_interrupt,1 /* 1 interrupt per frame */
  541.         },
  542.         {
  543.             CPU_M6502 | CPU_AUDIO_CPU,
  544.             3579000 / 4,        /* 3.579 / 4 MHz */
  545.             readmem_snd,writemem_snd,0,0,
  546.             gameplan_interrupt,1
  547.         },
  548.     },
  549.     57, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  550.     1,                            /* CPU slices per frame */
  551.     0,                            /* init_machine */
  552.  
  553.     /* video hardware */
  554.     32*8, 32*8,                    /* screen_width, height */
  555.     { 0, 32*8-1, 0, 32*8-1 },        /* visible_area */
  556.     0,
  557.     sizeof(palette) / sizeof(palette[0]) / 3, 0,
  558.     init_palette,
  559.  
  560.     VIDEO_TYPE_RASTER, 0,
  561.     gameplan_vh_start,
  562.     generic_bitmapped_vh_stop,
  563.     generic_bitmapped_vh_screenrefresh,
  564.  
  565.     0, 0, 0, 0,
  566.     {
  567.         {
  568.             SOUND_AY8910,
  569.             &ay8910_interface
  570.         }
  571.     }
  572. };
  573.  
  574. /***************************************************************************
  575.  
  576.   Game driver(s)
  577.  
  578. ***************************************************************************/
  579.  
  580. /*
  581. the manuals for Megattack and the schematics for Kaos are up
  582. on spies now. I took a quick look at the rom mapping for kaos
  583. and it looks like the roms are split this way:
  584.  
  585. 9000 G2 bot 2k
  586. 9800 J2 bot 2k
  587. A000 J1 bot 2k
  588. A800 G1 bot 2k
  589. B000 F1 bot 2k
  590. B800 E1 bot 2k
  591.  
  592. D000 G2 top 2k
  593. D800 J2 top 2k
  594. E000 J1 top 2k
  595. E800 G1 top 2k
  596. F000 F1 top 2k
  597. F800 E1 top 2k
  598.  
  599. there are three 6522 VIAs, at 2000, 2800, and 3000
  600. */
  601.  
  602. ROM_START( kaos )
  603.     ROM_REGION( 0x10000, REGION_CPU1 )
  604.     ROM_LOAD( "kaosab.g2",    0x9000, 0x0800, 0xb23d858f )
  605.     ROM_CONTINUE(                 0xd000, 0x0800             )
  606.     ROM_LOAD( "kaosab.j2",    0x9800, 0x0800, 0x4861e5dc )
  607.     ROM_CONTINUE(                 0xd800, 0x0800             )
  608.     ROM_LOAD( "kaosab.j1",    0xa000, 0x0800, 0xe055db3f )
  609.     ROM_CONTINUE(                 0xe000, 0x0800             )
  610.     ROM_LOAD( "kaosab.g1",    0xa800, 0x0800, 0x35d7c467 )
  611.     ROM_CONTINUE(                 0xe800, 0x0800             )
  612.     ROM_LOAD( "kaosab.f1",    0xb000, 0x0800, 0x995b9260 )
  613.     ROM_CONTINUE(                 0xf000, 0x0800             )
  614.     ROM_LOAD( "kaosab.e1",    0xb800, 0x0800, 0x3da5202a )
  615.     ROM_CONTINUE(                 0xf800, 0x0800             )
  616.  
  617.     ROM_REGION( 0x10000, REGION_CPU2 )
  618.     ROM_LOAD( "kaossnd.e1",   0xf800, 0x800, 0xab23d52a )
  619. ROM_END
  620.  
  621.  
  622. ROM_START( killcom )
  623.     ROM_REGION( 0x10000, REGION_CPU1 )
  624.     ROM_LOAD( "killcom.e2",   0xc000, 0x800, 0xa01cbb9a )
  625.     ROM_LOAD( "killcom.f2",   0xc800, 0x800, 0xbb3b4a93 )
  626.     ROM_LOAD( "killcom.g2",   0xd000, 0x800, 0x86ec68b2 )
  627.     ROM_LOAD( "killcom.j2",   0xd800, 0x800, 0x28d8c6a1 )
  628.     ROM_LOAD( "killcom.j1",   0xe000, 0x800, 0x33ef5ac5 )
  629.     ROM_LOAD( "killcom.g1",   0xe800, 0x800, 0x49cb13e2 )
  630.     ROM_LOAD( "killcom.f1",   0xf000, 0x800, 0xef652762 )
  631.     ROM_LOAD( "killcom.e1",   0xf800, 0x800, 0xbc19dcb7 )
  632.  
  633.     ROM_REGION( 0x10000, REGION_CPU2 )
  634.     ROM_LOAD( "killsnd.e1",   0xf800, 0x800, 0x77d4890d )
  635. ROM_END
  636.  
  637. ROM_START( megatack )
  638.     ROM_REGION( 0x10000, REGION_CPU1 )
  639.     ROM_LOAD( "megattac.e2",  0xc000, 0x800, 0x33fa5104 )
  640.     ROM_LOAD( "megattac.f2",  0xc800, 0x800, 0xaf5e96b1 )
  641.     ROM_LOAD( "megattac.g2",  0xd000, 0x800, 0x670103ea )
  642.     ROM_LOAD( "megattac.j2",  0xd800, 0x800, 0x4573b798 )
  643.     ROM_LOAD( "megattac.j1",  0xe000, 0x800, 0x3b1d01a1 )
  644.     ROM_LOAD( "megattac.g1",  0xe800, 0x800, 0xeed75ef4 )
  645.     ROM_LOAD( "megattac.f1",  0xf000, 0x800, 0xc93a8ed4 )
  646.     ROM_LOAD( "megattac.e1",  0xf800, 0x800, 0xd9996b9f )
  647.  
  648.     ROM_REGION( 0x10000, REGION_CPU2 )
  649.     ROM_LOAD( "megatsnd.e1",  0xf800, 0x800, 0x0c186bdb )
  650. ROM_END
  651.  
  652. ROM_START( challeng )
  653.     ROM_REGION( 0x10000, REGION_CPU1 )
  654.     ROM_LOAD( "chall.6",      0xa000, 0x1000, 0xb30fe7f5 )
  655.     ROM_LOAD( "chall.5",      0xb000, 0x1000, 0x34c6a88e )
  656.     ROM_LOAD( "chall.4",      0xc000, 0x1000, 0x0ddc18ef )
  657.     ROM_LOAD( "chall.3",      0xd000, 0x1000, 0x6ce03312 )
  658.     ROM_LOAD( "chall.2",      0xe000, 0x1000, 0x948912ad )
  659.     ROM_LOAD( "chall.1",      0xf000, 0x1000, 0x7c71a9dc )
  660.  
  661.     ROM_REGION( 0x10000, REGION_CPU2 )
  662.     ROM_LOAD( "chall.snd",    0xf800, 0x800, 0x1b2bffd2 )
  663. ROM_END
  664.  
  665.  
  666.  
  667. GAME( 1981, kaos,     0, gameplan, kaos,     0, ROT270, "GamePlan", "Kaos" )
  668. GAME( 1980, killcom,  0, gameplan, killcom,  0, ROT0,   "GamePlan (Centuri license)", "Killer Comet" )
  669. GAME( 1980, megatack, 0, gameplan, megatack, 0, ROT0,   "GamePlan (Centuri license)", "MegaTack" )
  670. GAME( 1980, challeng, 0, gameplan, challeng, 0, ROT0,   "GamePlan (Centuri license)", "Challenger" )
  671.